package com.xjj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xjj.entity.Klass;
import com.xjj.entity.Manager;
import com.xjj.entity.Student;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.jdbc.SQL;
import org.checkerframework.checker.index.qual.SameLen;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * @author sxy
 * @version 1.0
 * @date 2022/10/20 14:46
 */
@Mapper
public interface ManagerMapper extends BaseMapper<Manager> {
    @Select("select m.* ,r.name as roleName " +
            "from xjj_manager m ,xjj_role r " +
            "where account=#{account} " +
            "and m.role_id = r.id")
    Manager getByAccount(String account);

    @Select("select * from xjj_manager where id=#{id}")
    Manager getManagerById(int id);

    @Select("select m.id,subject from xjj_manager m ,xjj_klass_teacher t where m.id = t.manager_id and t.klass_id = #{klassId}")
    List<Manager> getAllTeacherByKlassId(int klassId);
}

